package com.learning.sims.status;

import android.util.Log;

import com.learning.sims.people.People;
import com.learning.sims.utils.SimsUtil;

/**
 * Created by xie on 2017/4/22.
 */

public class EatStatus implements IStatus {

    private double footPrice = 0.5;
    private double footEnergy = 1;

    @Override
    public void doSomething(long time, People people) {

        if(SimsUtil.isSleepTime(time)){
            people.setStatus(Status.GotoSleep);
            return;
        }

        while (true){
            if(people.getMoney() < footPrice){
                break;
            }else if(people.getEnergy() + footEnergy >= people.getMaxEnergy()){
                break;
            }
            people.setEnergy(people.getEnergy() + footEnergy);
            people.setMoney(people.getMoney() - footPrice);
        }

        Log.d("Sims","Eat = "+people.getEnergy()+" "+people.getMoney());
        people.setStatus(Status.GotoMining);

    }

}
